/*
 * @Author: linzaifei 1609781601@qq.com
 * @Date: 2024-09-06 10:15:30
 * @LastEditors: linzaifei 1609781601@qq.com
 * @LastEditTime: 2025-08-15 14:33:28
 * @FilePath: /mapbox-vue-h5/src/api/vr.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from "./request";

import { useAccountStore } from "@/stores";
import type { AxiosProgressEvent } from "axios";

// VR详情
export const getVrInfo=(id: string)=> {
  let accountStore = useAccountStore();
  return request.get(`/pc/v1/showVrInfo`,{
    params:{
      'id':id,
      'user_id':accountStore.account.user.id
    }
  });
}
  ///vr列表
export const getVrDataV2=(data:{})=> {
  return request.get(`/pc/v1/getVrDataV2`,{
    params:data
  });
}

//收藏 和取消收藏
export function setVrCollect(data_id:string){
  let accountStore = useAccountStore();
	return request.post('/pc/v1/setVrCollect',{
    "data_id":data_id,
    "user_id":accountStore.account.user.id,
  })
}
//收藏列表
export function getVrCollectList(page:number = 1){
	return request.get('/pc/v1/getVrCollectList',{
    params:{
      "per_page":20,
      "page":page,
    }
  })
}
export function getPublickCollectList(){
	return request.get('/userPoint/adminList',{
  })
}




//收藏列表
export function getMy360ImagesAll(){
  let accountStore = useAccountStore();
	return request.get('/pc/v1/my360ImagesAll',{
    params:{
     "user_id":accountStore.account.user.id,
    }
  })
}
// 获取随机
export function getRandVrData(){
  let accountStore = useAccountStore();
	return request.get('/pc/v1/getRandVrData',{
    params:{
     "user_id":accountStore.account.user.id,
    }
  })
}
///获取附近VR
export function getSoonVr(longitude:number, latitude:number){
  let params = {"jd":longitude,"wd":latitude}
	return request.get('/pc/v1/getSoonVr',{
    params:params
  })
}



import axios from "axios";
const service = axios.create({
  baseURL:"/",
  timeout: 5000000000
})

service.interceptors.response.use((response) => {
    return response.data;
}, error => {
  console.log(error)
  return Promise.reject(new Error(error))
})



export const upload = (params: any, onUploadProgress: (progressEvent: AxiosProgressEvent) => void) => { 
  //  return request.upload('/pc/v1/upload', params, onUploadProgress)
  return service({
    url: '/pc/v1/upload',
    method: 'post',
    data: params,
    onUploadProgress
  })
}
